<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <img src="../assets/logo.jpg" alt="">
        <span>BARTeam</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <!-- 页面主题区域 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="200px">
        <!-- 侧边栏菜单区域 -->
        <el-menu background-color="#333744" text-color="#fff" active-text-color="#409eef" :router=true>
          <el-menu-item index="/myself">
            <template slot="title">
              <i class="el-icon-s-home"></i>
              <span>个人中心</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/members">
            <i class="el-icon-user-solid"></i>
            <span slot="title">成员信息</span>
          </el-menu-item>
          <el-menu-item index="/logs">
            <i class="el-icon-document"></i>
            <span slot="title">日志记录</span>
          </el-menu-item>
          <el-menu-item index="/activites">
            <i class="el-icon-s-flag"></i>
            <span slot="title">活动发布</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <!-- 右侧内容主体 -->
      <el-main>
        <keep-alive>
          <router-view :key="$route.fullPath">
          </router-view>
        </keep-alive>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  export default {
    methods: {
      //退出登录
      logout: function () {
        window.sessionStorage.clear();
        this.$router.push("/login");
      }
    }
  };

</script>

<style lang="less" scoped>
  // home根组件上下结构(头部导航栏区域 + 导航栏下面的区域)
  .home-container {
    height: 100%;

    // 头部导航栏区域
    .el-header {
      // position: fixed; //固定定位，吸顶效果
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #373d41;
      color: #fff;
      font-size: 20px;

      >div {
        display: flex;
        align-items: center;

        span {
          margin-left: 15px;
        }
      }

      img {
        width: 60px;
        height: 60px;
        padding: 5px;
        box-sizing: border-box;
      }

    }

    //导航栏下面的区域
    .el-container {
      // margin-top: 60px; //导航栏吸顶效果时，增加上外边距。
      height: calc(100% - 60px);

      // 侧边栏
      .el-aside {
        background-color: #333744;
        //侧边栏菜单
        .el-menu {
          border-right: none;
        }
      }

      // 右边主体区域
      .el-main {
        overflow-y: auto; //右边主体区域增加垂直滚动条
        background-color: #eaedf1;
      }
    }

  }

</style>
